// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import * as Icon from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

export const asyncRouterMap = [

  {
    path: '/',
    name: 'root',
    component: BasicLayout,
    redirect: '/store/index',
    meta: { title: '超级管理后台' },
    children: [
      {
        name: 'Store',
        path: '/store',
        redirect: '/store/index',
        component: RouteView,
        meta: { title: '门店管理', keepAlive: true, icon: Icon['shop'], permission: ['store'] },
        children: [
          {
            path: '/store/index',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/index'),
            meta: { title: '门店列表', keepAlive: true, hiddenHeaderContent: false, permission: ['store'] }
          },
          {
            path: '/store/apply',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/apply'),
            meta: { title: '申请列表', keepAlive: true, hiddenHeaderContent: false, permission: ['store'] }
          },
          {
            path: '/store/applyDetail',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/ApplyDetail'),
            meta: { title: '申请详情', keepAlive: false, hiddenHeaderContent: false, permission: ['store'] },
            hidden: true
          },
          {
            path: '/store/industry',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/industry'),
            meta: { title: '行业列表', keepAlive: true, hiddenHeaderContent: false, permission: ['store'] }
          },
          {
            path: '/store/category',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/category'),
            meta: { title: '分类列表', keepAlive: true, hiddenHeaderContent: false, permission: ['store'] }
          },
          {
            path: '/store/settle/plan',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/settle/plan/Index'),
            meta: { title: '入驻套餐', keepAlive: true, hiddenHeaderContent: false, permission: ['store'] }
          },
          {
            path: '/store/catchLog',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/catchLog'),
            meta: { title: '抚恤金领取', keepAlive: true, hiddenHeaderContent: false, permission: ['store'] }
          },
          {
            path: '/store/recycle',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/recycle'),
            meta: { title: '回收站', keepAlive: true, permission: ['store'] }
          }
        ]
      },

      // 会员管理
      {
        path: '/customer',
        name: 'customer',
        component: RouteView,
        redirect: '/customer/index',
        meta: { title: '会员管理', keepAlive: true, icon: Icon['user'], permission: ['/customer'] },
        children: [
          {
            path: '/customer/index',
            component: () => import(/* webpackChunkName: "user" */ '@/views/customer/Index'),
            meta: { title: '会员列表', keepAlive: false, permission: ['/user/index'] }
          },
          {
            path: '/customer/grade/index',
            component: () => import(/* webpackChunkName: "user" */ '@/views/customer/grade/Index'),
            meta: { title: '会员等级', keepAlive: false, permission: ['/customer/grade/index'] }
          },
          {
            path: '/customer/share',
            component: () => import(/* webpackChunkName: "user" */ '@/views/customer/share/index'),
            meta: { title: '推广佣金', keepAlive: false, permission: ['/customer/share'] }
          },
          {
            path: '/customer/balance',
            component: RouteView,
            redirect: '/customer/balance/index',
            meta: { title: '余额记录', keepAlive: false, permission: ['/customer/balance'] },
            children: [
              {
                path: '/customer/recharge/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/customer/recharge/Index'),
                meta: { title: '充值记录', keepAlive: false, permission: ['/customer/recharge/index'] }
              },
              {
                path: '/customer/balance/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/customer/balance/Index'),
                meta: { title: '余额明细', keepAlive: false, permission: ['/customer/balance/index'] }
              }
            ]
          }
        ]
      },
      {
        path: '/market',
        name: 'market',
        component: RouteView,
        redirect: '/market/recharge/plan/index',
        meta: { title: '营销管理', keepAlive: true, icon: Icon['market'], permission: ['/market'] },
        children: [
          {
            path: '/market/recharge',
            component: RouteView,
            redirect: '/market/recharge/plan/index',
            meta: { title: '会员充值', keepAlive: false, permission: ['/market/recharge'] },
            children: [
              {
                path: '/market/recharge/plan/index',
                component: () => import(/* webpackChunkName: "market" */ '@/views/market/recharge/plan/Index'),
                meta: { title: '充值套餐', keepAlive: false, permission: ['/market/recharge/plan/index'] }
              },
              {
                path: '/market/recharge/setting',
                component: () => import(/* webpackChunkName: "market" */ '@/views/market/recharge/Setting'),
                meta: { title: '充值设置', keepAlive: false, permission: ['/market/recharge/setting'] }
              }
            ]
          }
          // {
          //   path: '/market/points',
          //   component: RouteView,
          //   redirect: '/market/points/setting',
          //   meta: { title: '积分管理', keepAlive: false, permission: ['/market/points'] },
          //   children: [
          //     {
          //       path: '/market/points/setting',
          //       component: () => import(/* webpackChunkName: "market" */ '@/views/market/points/Setting'),
          //       meta: { title: '积分设置', keepAlive: false, permission: ['/market/points/setting'] }
          //     },
          //     {
          //       path: '/market/points/log',
          //       component: () => import(/* webpackChunkName: "market" */ '@/views/market/points/Log'),
          //       meta: { title: '积分明细', keepAlive: false, permission: ['/market/points/log'] }
          //     }
          //   ]
          // }
        ]
      },
      {
        path: '/content',
        name: 'content',
        component: RouteView,
        redirect: '/content/article/index',
        meta: { title: '内容管理', keepAlive: true, icon: Icon['content'], permission: ['/content'] },
        children: [
          {
            path: '/content/article',
            component: RouteView,
            meta: { title: '文章管理', keepAlive: false, permission: ['/content/article'] },
            children: [
              {
                path: '/content/article/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/content/article/Index'),
                meta: { title: '文章列表', keepAlive: false, permission: ['/content/article/index'] }
              },
              {
                path: '/content/article/category/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/content/article/category/Index'),
                meta: { title: '文章分类', keepAlive: false, permission: ['/content/article/category/index'] }
              }
            ]
          },
          {
            path: '/content/files',
            component: RouteView,
            redirect: '/content/files/index',
            meta: { title: '文件库管理', keepAlive: false, permission: ['/content/files'] },
            children: [
              {
                path: '/content/files/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/content/files/Index'),
                meta: { title: '文件列表', keepAlive: false, permission: ['/content/files/index'] }
              },
              {
                path: '/content/files/group/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/content/files/group/Index'),
                meta: { title: '文件分组', keepAlive: false, permission: ['/content/files/group/index'] }
              }
            ]
          },
          {
            path: '/content/banner',
            component: RouteView,
            redirect: '/content/banner/index',
            meta: { title: '轮播图', keepAlive: false, permission: ['/content/files'] },
            children: [
              {
                path: '/content/banner/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/banner/Index'),
                meta: { title: '首页轮播图', keepAlive: false, permission: ['/content/banner/index'] }
              }
            ]
          },
          {
            path: '/content/notify',
            component: RouteView,
            redirect: '/content/notify/index',
            meta: { title: '公告', keepAlive: false, permission: ['/content/files'] },
            children: [
              {
                path: '/content/notify/index',
                component: () => import(/* webpackChunkName: "content" */ '@/views/notify/Index'),
                meta: { title: '首页公告', keepAlive: false, permission: ['/content/notify/index'] }
              }
            ]
          },
          {
            path: '/content/help/index',
            component: () => import(/* webpackChunkName: "content" */ '@/views/content/help/Index'),
            meta: { title: '帮助中心', keepAlive: false, permission: ['/content/help/index'] }
          }
        ]
      },
      {
        path: '/statistics',
        name: 'statistics',
        component: () => import(/* webpackChunkName: "statistics" */ '@/views/statistics/Index'),
        meta: { title: '数据统计', keepAlive: true, icon: Icon['statistics'], permission: ['/setting'] }
      },
      {
        name: 'Setting',
        path: '/setting',
        redirect: '/setting/cache',
        component: RouteView,
        meta: { title: '系统设置', keepAlive: true, icon: Icon['setting'], permission: ['setting'] },
        children: [
          {
            path: '/setting/trade',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/trade'),
            meta: { title: '提现设置', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/sms',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/sms'),
            meta: { title: '短信通知', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/storage',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/storage'),
            meta: { title: '上传设置', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/cache',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/cache'),
            meta: { title: '清理缓存', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/science',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/science'),
            meta: { title: '环境检测', keepAlive: false, permission: ['setting'] }
          }
        ]
      },

      {
        name: 'Manage',
        path: '/manage',
        redirect: '/manage/user',
        component: RouteView,
        meta: { title: '管理员设置', keepAlive: true, icon: Icon['manage'], permission: ['manage'] },
        children: [
          {
            path: '/manage/user',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/manage/user/Index'),
            meta: { title: '管理员列表', keepAlive: false, permission: ['manage'] }
          },
          {
            path: '/manage/role',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/manage/role/Index'),
            meta: { title: '角色管理', keepAlive: false, permission: ['manage'] }
          }
        ]
      }

    ]
  },

  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        // name: 'Login',
        path: 'login',
        meta: { title: '超级管理后台' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
